package com.xzh.api;

import com.xzh.service.AppointEcharsService;
import com.xzh.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/appointEchars")
public class AppointEcharsApi {
    private AppointEcharsService appointEcharsService;

    @Autowired
    public AppointEcharsApi(AppointEcharsService appointEcharsService) {
        this.appointEcharsService = appointEcharsService;
    }

    @GetMapping("/statistics")
    public ResponseEntity<JsonResult<?>> statistics(){
        List<Map<String, Object>> statistics = appointEcharsService.statistics();
        return ResponseEntity.ok(JsonResult.success(statistics));
    }

}
